//  设置地图高
document.getElementsByClassName("bigdiv")[0].style.height = document.body.offsetHeight-document.getElementsByClassName("main_head")[0].offsetHeight+"px";
console.log(document.body.offsetHeight)
//  地图
var map = new BMap.Map("allmap");
navigator.geolocation.getCurrentPosition(function (position) {
    console.log(position.coords)
    longitude = position.coords.longitude;
    latitude = position.coords.latitude;
});
var point = new BMap.Point(117.068832, 39.062708);
//main.enableScrollWheelZoom(true);
map.enableScrollWheelZoom();    //启用滚轮放大缩小，默认禁用
map.enableContinuousZoom();    //启用地图惯性拖拽，默认禁用
map.centerAndZoom(point, 15);
map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件
var marker = new BMap.Marker(point);  // 创建标注
map.addOverlay(marker);              // 将标注添加到地图中
//    marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
//创建信息窗口
var sContent ='<div class="frame_wrap"> ' +
    '<div class="frame_top">南站花园站</div> ' +
    '<div class="frame_place">天津南路 南站花园北门西侧</div> ' +
    '<div class="frame_content"> ' +
    '<span class="frame_left"> ' +
    '<span>可租</span> ' +
    '<span>15</span></span> ' +
    '<span class="frame_right"> ' +
    '<span>可还</span> ' +
    '<span>28</span> ' +
    '</span> ' +
    '</div> ' +
    '</div>';
var infoWindow = new BMap.InfoWindow(sContent);  // 创建信息窗口对象
map.centerAndZoom(point, 15);
map.addOverlay(marker);
marker.addEventListener("click", function(){
    this.openInfoWindow(infoWindow);
    // 图片加载完毕重绘infowindow
    // document.getElementById('imgDemo').onload = function (){
    //     infoWindow.redraw();
    // }
    $(".frame_wrap").click(function () {
        window.location.href = "unlock.html"
    })
});


//点击生成经纬度
map.addEventListener("click",function(e){
    console.log(e.point.lng + "," + e.point.lat);
});
//  user start
//$(function () {
//  $(".head_user").click(function (e) {
//      e.stopPropagation();
//      $(".user_all").animate({left:0},"slow");
//      $(".user_right_slide").css({display:"block"})
//  })
//  $(".user_right_slide").click(function () {
//      var animate_left = -$(this).height()*100/100;
//      $(".user_all").animate({left:animate_left},"slow",function () {
//          $(".user_right_slide").css({display:"none"})
//      });
//  })
//  $(".user_all").click(function (e) {
//      e.stopPropagation()
//  })
//})



